FROM python:3.11-slim-bookworm
WORKDIR /app

RUN sed -i "s@http://deb.debian.org@https://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list.d/debian.sources
RUN apt update
RUN apt-get install libmariadb-dev-compat libmariadb-dev pkg-config  -y
RUN apt install build-essential -y
RUN  pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install poetry  && poetry config --local virtualenvs.create  false
RUN apt install netcat-openbsd -y
#
COPY pyproject.toml ./
RUN poetry install -v

RUN opentelemetry-bootstrap -a install


ADD . ./

RUN python manage.py  collectstatic


COPY entrypoint.sh /usr/bin 

RUN chmod +x /usr/bin/entrypoint.sh